<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form search_from" lay-filter="search_from">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">用户名：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">退款单号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="refund_no" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button class="layui-btn layui-btn-sm" lay-filter="search_button" lay-submit>搜索</button>
                                <button class="layui-btn layui-btn-sm layui-hide" lay-event="export_button" lay-filter="export_button" lay-submit><i class="layui-icon layui-icon-export"></i>导出</button>
                            </div>
                            <div class="layui-inline layui-font-12 search_more_button">
                                更多搜索条件<i class="sm_iconfont icon-xiangxia"></i>
                            </div>
                        </div>
                        <div class="layui-form-item layui-hide">
                            <div class="layui-inline">
                                <label class="layui-form-label">订单号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="order_no" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">交易单号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="trade_no" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">三方单号：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="payment_no" placeholder="请输入" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">类型：</label>
                                <div class="layui-input-inline">
                                    <script type="text/html" template lay-url="{{ layui.setter.apiHost }}/financial/trade_refund/get_type" lay-done="layui.form.render();">
                                        <select name="type">
                                            <option value=""></option>
                                            {{# layui.each(d.data, function(index, item){ }}
                                            <option value="{{ index }}">{{ item }}</option>
                                            {{# }); }}
                                        </select>
                                    </script>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">状态：</label>
                                <div class="layui-input-inline">
                                    <script type="text/html" template lay-url="{{ layui.setter.apiHost }}/financial/trade_refund/get_status" lay-done="layui.form.render();">
                                        <select name="status">
                                            <option value=""></option>
                                            {{# layui.each(d.data, function(index, item){ }}
                                            <option value="{{ index }}">{{ item }}</option>
                                            {{# }); }}
                                        </select>
                                    </script>
                                </div>
                            </div>
                            <div class="layui-inline" id="select_at">
                                <label class="layui-form-label">起止时间：</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="time_range" id="time_range" placeholder="请选择" autocomplete="off" class="layui-input" readonly>
                                </div>
                            </div>
                        </div>
                    </div>
                    <table class="layui-hide" id="table_list" lay-filter="table_list"></table>

                    <script type="text/html" id="status_tmp">
                        {{# if(d.status == 0){ }}
                        <span class="layui-badge layui-bg-blue">{{ d.status_text }}</span>
                        {{# }else if(d.status == 1){ }}
                        <span class="layui-badge layui-bg-green">{{ d.status_text }}</span>
                        {{# }else if(d.status == 2){ }}
                        <span class="layui-badge layui-bg-orange">{{ d.status_text }}</span>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="../../../../layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '../../../../layuiadmin/',//静态资源所在路径
        version: true
    }).extend({
        index: 'modules/admin/index',//主入口模块
    }).use(['index', 'table_common'], function () {
        let table_common = layui.table_common,
            table = layui.table,
            laydate = layui.laydate,
            model_url = '/financial/trade_refund';

        table_common.set_model_url(model_url);//设置默认模块地址

        table.render({
            elem: '#table_list',
            url: layui.setter.apiHost + model_url,
            toolbar: '#toolbar',
            cols: [[
                {type: 'checkbox'},
                {field: 'id', title: 'ID', width: 70, align: 'center'},
                {field: 'refund_no', title: '退款单号', minWidth: 200},
                {field: 'order_no', title: '订单号', minWidth: 200},
                {field: 'trade_no', title: '交易单号', minWidth: 200},
                {field: 'username', title: '用户名', width: 120},
                {field: 'type', title: '交易类型', width: 100, align: 'center'},
                {field: 'subtotal', title: '金额', width: 100},
                {field: 'payment', title: '支付方式', width: 100, align: 'center'},
                {field: 'payment_no', title: '第三方单号', minWidth: 250},
                {field: 'status_text', title: '状态', width: 100, align: 'center', templet: '#status_tmp'},
                {field: 'pay_at', title: '退款时间', width: 170, align: 'center'},
                {field: 'note', title: '备注', minWidth: 100},
                {field: 'platform', title: '平台', width: 100, align: 'center'},
                {field: 'created_at', title: '创建时间', width: 170, align: 'center'}
            ]],
            page: true,
            done: function () {
                table_common.set_button(model_url);
            }
        });

        //日期
        laydate.render({
            elem: '#time_range',
            range: '~',
            type: 'date'
        });
    });
</script>
</body>
</html>
